﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace epk23.PartIIProject
{
    public class Rule
    {
        public int ruleNumber { get; set; }
        public int targetRuleNumber { get; set; }
        public String targetRegister { get; set; }
    }

    interface PrintableRule
    {
        void printRule();
    }

    class IncrementRule : Rule, PrintableRule
    {

        public IncrementRule(int ruleNumber, String targetRegister, int targetRuleNumber)
        {
            this.ruleNumber = ruleNumber;
            this.targetRegister = targetRegister;
            this.targetRuleNumber = targetRuleNumber;
        }

        public void printRule()
        {
            String ruleText = "Increment Register " + this.targetRegister;
            Console.WriteLine("Executing Rule number " + ruleNumber + ": " + ruleText);

        }
    }

    class DecrementRule : Rule, PrintableRule
    {
        public int targetRuleNumber2 { get; set; }

        public DecrementRule(int ruleNumber, String targetRegister, int targetRule1, int targetRule2)
        {
            this.ruleNumber = ruleNumber;
            this.targetRegister = targetRegister;
            this.targetRuleNumber = targetRule1;
            this.targetRuleNumber2 = targetRule2;
        }

        public void printRule()
        {
            String ruleText = "Decrement Register " + this.targetRegister;
            Console.WriteLine("Executing Rule number " + ruleNumber + ": " + ruleText);
        }
    }

    class HaltRule : Rule
    {
        public HaltRule(int ruleNumber)
        {
            this.ruleNumber = ruleNumber;
            this.targetRegister = null;
        }
    }

    class MachineRule : Rule, PrintableRule
    {
        public string machineName { get; set; }

        public MachineRule(int ruleNumber, string machineName, int targetRuleNumber)
        {
            this.targetRuleNumber = targetRuleNumber;
            this.machineName = machineName;
            this.ruleNumber = ruleNumber;
            this.targetRegister = null;
        }

        public void printRule()
        {
            String ruleText = "Loading Machine " + this.machineName;
        }
    }

}
